﻿@*
@using Microsoft.AspNet.Identity
@if (Request.IsAuthenticated)
{
    using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "navbar-right" }))
    {
    @Html.AntiForgeryToken()

    <ul class="nav navbar-nav navbar-right">
        <li>
            @Html.ActionLink("Hello " + User.Identity.GetUserName() + "!", "Manage", "Account", routeValues: null, htmlAttributes: new { title = "Manage" })
        </li>
        <li><a href="javascript:document.getElementById('logoutForm').submit()">Log off</a></li>
    </ul>
    }
}
else
{
    <ul class="nav navbar-nav navbar-right">
        <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
        <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
    </ul>
}
*@
@using Microsoft.AspNet.Identity
@if (Request.IsAuthenticated)
{
    //todo find way how show logout form
    //using (Html.BeginForm("LogOff", "Account", FormMethod.Post, new { id = "logoutForm", @class = "login-form" }))
    //{
    //    @Html.AntiForgeryToken()
        <a href="#" class="dropdown-toggle" data-toggle="dropdown">
            <i class="glyphicon glyphicon-user"></i>
            <span>@User.Identity.GetUserName() <i class="caret"></i></span>
            <ul class="dropdown-menu">
                <!-- User image -->
                <li class="user-header bg-light-blue" style="margin:10px;">
                    <img src="img/avatar3.png" class="img-circle" alt="User Image" style="margin:5px;" />
                    <p style="margin:5px;">
                        @User.Identity.Name

                        <small>Member since Nov. 2012</small>
                    </p>
                </li>
               <!-- Menu Footer-->
                <li class="user-footer" style="margin:10px;">
                    <div class="pull-left">
                        <a href="#" class="btn btn-default btn-flat">Profile</a>
                    </div>
                    <div class="pull-right">
                        <a href="javascript:document.getElementById('logoutForm').submit()" class=" btn btn-default btn-flat">Sign out</a>
                    </div>
                </li>
            </ul>
        </a>
   // }

    // @Html.ActionLink(User.Identity.GetUserName(), "Manage", "Account", routeValues: null, htmlAttributes: new { title = "Manage" })
}
else
{
    <ul class="nav navbar-nav navbar-right">
        <li>@Html.ActionLink("Log in", "Login", "Account", routeValues: null, htmlAttributes: new { id = "loginLink" })</li>
        <li>@Html.ActionLink("Register", "Register", "Account", routeValues: null, htmlAttributes: new { id = "registerLink" })</li>
    </ul>
}


